package hlhj.fhp.checkpoint.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.lzy.okgo.model.Response
import hlhj.fhp.checkpoint.http.Apis
import hlhj.fhp.checkpoint.http.CustomAction
import hlhj.fhp.checkpoint.http.LoadingAction
import hlhj.fhp.checkpoint.javaBean.NoticeDetailBean

/**
 * Created by Never Fear   on 2018\11\19 0019.
Never More....
 */
class NoticeDetailModule :BaseModule {

    var listener:NoticeDetailResp?=null
    fun getNoticeDetail(id:Int,c:Context){
        Apis.getNoticeDetail(id)
                ?.let {
                    it.doOnSubscribe(LoadingAction(c))
                            .subscribe(object :CustomAction<Response<NoticeDetailBean>>(c){
                                override fun httpSuccess(t: Response<NoticeDetailBean>) {
                                    listener?.detailResp(t.body())
                                }
                            })
                }
    }


    interface NoticeDetailResp{
        fun detailResp(noticeDetailBean: NoticeDetailBean)
    }
}